This is a replication folder for Ratkovic and Tingley (2016) “ Sparse Estimation and Uncertainty with Application to Subgroup Analysis.”  All files, data, and scripts needed to generate the figures and results in the paper are present in this folder.


The folder contains two sets of files, those for the Bechtel & Scheve analysis and those for the simulations.  These files produce the results and figures from the applied example and simulation study, respectively.  Unzip results_bch.zip before trying to reproduce simulation results.  Please note that we use STAN code in our simulation file that may not work on a PC.  The code has been tested on both a Mac and Linux environment.

The following R packages were used to produce these results:

1) sparsereg version 1.2
2) glmnet version 2.0-5
3) coda version 0.18-1
4) arm version 1.8-6
5) monomvn version 1.9-6
6) rstan version 2.10.0
7) plyr version 1.8.4
8) dplyr version 0.5.0
9) reshape2 version 1.4.1
10) leaps version 2.9

Manifest below:

Bechtel & Scheve Files:
1) Climate-PNAS-Sparsereg-EM.Rdata: Fitted sparsereg object on the data using EM.  See Ranalysis-BechtelScheve.R for how it was generated.  We include this object because fitting it can be time consuming (~2-5 mins).  

2) Climate-PNAS-Sparsereg.Rdata: Fitted sparsereg object on the data using MCMC.  See Ranalysis-BechtelScheve.R for how it was generated.  We include this object because fitting it can be time consuming (~1 day).   

3) pnas_cjoint.Rdata: Data used in producing conjoint results from R package joint.

4) Ranalysis-BechtelScheve.R: Runs all sparsereg analysis and produces figures in the paper.

5) SetupPNAS-All.Rdata: Data used for sparsereg analysis.

Simulation Files:
1) AnalyzeSims.R: Sourcing this file will compile simulation output and produce figures, if results_bch has been unzipped.

2) BCH_LassoPlusOLS.R: Implements LASSO and post-LASSO OLS method of Belloni and Chernozhukov 2013.  Used in simulations.

3) results_bch.zip: Zip file with simulation output.  Generated on a cluster; slurm file etc. available upon request.

4) sparseregSimulations.R: File for running simulations and saving output.  